package com.fjl.postProcesser;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class MyBeanPostProcessor implements BeanPostProcessor {
	/*
	在初始化方法执行之后，被添加到单例池 singletonObjects 之前被回调
	 */
	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("beanPostProcessor的before()执行了...." + beanName);
		return bean;
	}

	/*
	在属性注入完毕， init 初始化方法执行之前被回调
	 */
	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {

		System.out.println("beanPostProcessor的after()执行了...."+ beanName);
		return bean;
	}
}
